#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>


int main(void) {
	int pid,w;
	freopen("teste.txt","w",stdin);

	printf("teste");

	pid = fork();	

	if(pid == 0) {
		char *env[] = {"grep","stdin",NULL};
		printf("child\n");
		printf("\nExec: %d",execvp("grep",env));
	} else {
		wait(&w);
	}

	
	return 0;

}
